package com.tjx.service.impl;

import com.tjx.entity.Carousel;
import com.tjx.mapper.CarouselMapper;
import com.tjx.service.ICarouselService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 轮播图表 服务实现类
 * </p>
 *
 * @author tjx
 * @since 2025-10-29
 */
@Service
public class CarouselServiceImpl extends ServiceImpl<CarouselMapper, Carousel> implements ICarouselService {

    @Autowired
    private CarouselMapper carouselMapper;

    /**
     * 查询所有轮播图
     */
    @Override
    public List<Carousel> carouselQueryAll() {
        return carouselMapper.selectList(null);
    }

    /**
     * 修改轮播图
     */
    @Override
    public Integer carouselUpdate(Carousel carousel) {
        carousel.setUpdateDate(LocalDate.now());
        return carouselMapper.updateById(carousel);
    }
}
